package 作业;

import java.util.ArrayList;
import java.util.List;

public class reverseList {
    public static void main(String[] args) {
        List list =new ArrayList();
        list.add("Hello");
        list.add("World");
        list.add("Lrarn");
        System.out.println(list);
        reverseList(list);


    }
    private static void reverseList(List<String> list){
        List<String> list1 = new ArrayList<>();
        for (int i = list.size() - 1; i >= 0; i--){
        list1.add(list.get(i));
    }
    list=list1;
        System.out.println(list);
}


}
